package demo06

/**
 * @author xiaoZhao
 * @date 2022/7/12
 * @describe 元组
 */
object Test10_Tuple {
  def main(args: Array[String]): Unit = {
    // 1。创建元祖
    val tuple = ("hello", 0, false,'a')
    println(tuple)

    // 2.访问元祖数据
    println(tuple._1)
    println(tuple._2)
    println(tuple._3)
    println(tuple._4)

    println(tuple.productElement(0))

    // 3.遍历元祖
    for (elem <- tuple.productIterator){
      println(elem)
    }

    // 4.嵌套元组
    val mulTuple = (112,32,"aa",("scala",90))
    println(mulTuple._4._2)
  }
}
